const mysql=require('mysql')
const mysqlObj=mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'szj20318',
    port:'3306',
    database:'xiaou'
});
mysqlObj.connect();
function exec(sql){
    return new Promise((resolve,rejest)=>{
        mysqlObj.query(sql,(err,data)=>{
            if(err){
                resolve([false,err]);
            }else{
                resolve([true,data]);
            }
        });
    });
}

module.exports=exec;